<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <router-link to="/home">主页</router-link>
        <router-link to="/product">产品详情</router-link>
        <!-- 路由出口 -->
        <router-view></router-view>
    </div>
</body>
<script src="./node_modules/vue/dist/vue.js"></script>
<script src="./node_modules/vue-router/dist/vue-router.js"></script>
<script>
    let routes=[
        {
            path:"/home",
            component:()=>Promise.resolve({
                template:`<h1>主页内容</h1>`
            })
        },
        {
            path:"/product",
            component:()=>import("./Product.js")
        }
    ]

    let router=new VueRouter({
        routes
    })

    let vm=new Vue({
        el:"#app",
        router,
    })


</script>
</html>